package com.jboy.test;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

class Person {
    private String name;
    private int age;
    
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    
    public String getName() { return name; }
    public int getAge() { return age; }
}

public class CombinedExercise {
    public static void main(String[] args) {
        List<Person> people = Arrays.asList(
            new Person("Alice", 20),
            new Person("Bob", 17),
            new Person("Charlie", 25),
            new Person("David", 19),
            new Person("Eve3333s", 123)
        );
        people.stream().filter(x->x.getAge()>18).map(x->x.getName()).max(Comparator.comparing(String::length)).ifPresent(System.out::println);

    }
}